//
//  StatusBottomView.swift
//  SinaWeiBo
//
//  Created by tuyue on 16/3/15.
//  Copyright © 2016年 xueyang.co.ltd. All rights reserved.
//

import UIKit
import SnapKit

class StatusBottomView: UIView {
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        setupUI()
        
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private func setupUI(){
        backgroundColor = UIColor(white: 0.9, alpha: 1)
        
        addSubview(repostBtn)
        addSubview(commentBtn)
        addSubview(zanBtn)
        
        repostBtn.snp_makeConstraints { (make) -> Void in
            make.top.left.bottom.equalTo(self)
        }
        
        commentBtn.snp_makeConstraints { (make) -> Void in
            make.top.bottom.equalTo(self)
            make.left.equalTo(repostBtn.snp_right)
            make.width.equalTo(repostBtn.snp_width)
        }
        
        zanBtn.snp_makeConstraints { (make) -> Void in
            make.top.bottom.equalTo(self)
            make.left.equalTo(commentBtn.snp_right)
            make.right.equalTo(self.snp_right)
            make.width.equalTo(commentBtn.snp_width)
        }
        
        let sep1 = sepView()
        let sep2 = sepView()
        
        addSubview(sep1)
        addSubview(sep2)
        
        let lineWidth:CGFloat = 0.4
        
        sep1.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(repostBtn.snp_right)
            make.height.equalTo(self.snp_height).multipliedBy(0.4)
            make.centerY.equalTo(self.snp_centerY)
            make.width.equalTo(lineWidth)
        }
        
        sep2.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(commentBtn.snp_right)
            make.height.equalTo(self.snp_height).multipliedBy(0.4)
            make.centerY.equalTo(self.snp_centerY)
            make.width.equalTo(lineWidth)
        }
        
        
    }
    
    //MARK: - 懒加载三个按钮，评论，转发，点赞
    
    lazy var repostBtn:UIButton = UIFactory.factoryButtonWithTitle("转发", backImageName: nil, titleColor: UIColor.darkGrayColor(), fontSize: 12, imageName: "timeline_icon_retweet")
    
    
    lazy var commentBtn:UIButton = UIFactory.factoryButtonWithTitle("评论", backImageName: nil, titleColor: UIColor.darkGrayColor(), fontSize: 12, imageName: "timeline_icon_comment")
    
    
    lazy var zanBtn:UIButton = UIFactory.factoryButtonWithTitle("点赞", backImageName: nil, titleColor: UIColor.darkGrayColor(), fontSize: 12, imageName: "timeline_icon_unlike")
    
    //MARK: - 分割线视图
    private func sepView() ->UIView{
        let lineView = UIView()
        /**设置分割线颜色*/
        lineView.backgroundColor = UIColor.blackColor()
        return lineView
    }
}
